package bcc.java8.chap04;

import java.util.List;
import java.util.stream.Collectors;

/**
 * .
 *
 * @author: bcc
 * 2020/11/3
 */
public class ThreeHighCaloricDishNames {
    public static void main(String[] args) {
        List<String> list = Dish.menu.stream().
                filter(d -> d.getCalories() > 300).
                map(Dish::getName).
                limit(3).
                collect(Collectors.toList());

        System.out.println(list);

        List<String> list2 = Dish.menu.parallelStream().
                filter(d -> d.getCalories() > 300).
                map(Dish::getName).
                limit(3).
                collect(Collectors.toList());

        System.out.println(list2);
    }
}
